//
//  BaseCollectionViewCell.m
//  WhereToTravel
//
//  Created by dlios on 15/10/12.
//  Copyright © 2015年 zhoushengmin. All rights reserved.
//

#import "BaseCollectionViewCell.h"

@implementation BaseCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self createView];
        [[NSNotificationCenter defaultCenter] postNotificationName:@"night" object:nil];
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(night) name:@"night" object:nil];
    }
    return self;
}

- (void)createView {    
    self.mistLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.mistLabel];
    self.mistLabel.backgroundColor = [UIColor clearColor];
    
    self.downLeftLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.downLeftLabel];
    self.downLeftLabel.backgroundColor = [UIColor clearColor];
    
    self.downRightLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.downRightLabel];
    self.downRightLabel.backgroundColor = [UIColor clearColor];
    
    self.upLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.upLabel];
    self.upLabel.backgroundColor = [UIColor clearColor];
    
    self.downLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.downLabel];
    self.downLabel.backgroundColor = [UIColor clearColor];

    self.perNumLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.perNumLabel];

    self.teLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.teLabel];

    self.label = [[UILabel alloc] init];
    [self.contentView addSubview:self.label];

}

- (void)night {
    if ([SingletonNight shareSingletonNight].isSelete == YES) {
        self.upLabel.textColor = [UIColor whiteColor];
        self.mistLabel.textColor = [UIColor whiteColor];
        self.downLeftLabel.textColor = [UIColor whiteColor];
        self.downRightLabel.textColor = [UIColor whiteColor];
        self.downLabel.textColor = [UIColor whiteColor];
        self.perNumLabel.textColor = [UIColor whiteColor];
        self.teLabel.textColor = [UIColor whiteColor];
        self.label.textColor = [UIColor whiteColor];
    }
    else {
        self.upLabel.textColor = [UIColor blackColor];
        self.mistLabel.textColor = [UIColor blackColor];
        self.downLeftLabel.textColor = [UIColor blackColor];
        self.downRightLabel.textColor = [UIColor blackColor];
        self.downLabel.textColor = [UIColor blackColor];
        self.perNumLabel.textColor = [UIColor blackColor];
        self.teLabel.textColor = [UIColor colorWithWhite:0.080 alpha:0.640];
        self.label.textColor = [UIColor blackColor];
    }
}

- (void)dealloc {
    [[NSNotificationCenter defaultCenter] removeObserver:self name:@"night" object:nil];
}

@end
